
<table class="layui-table" id="demo">
</table>
<script type="text/javascript">
    layui.use('table', function(){
        var table=layui.table;
        table.render({
            elem:"#demo",
            data:[{id:1,name:"张三"},{id:2,name:"李四"},{id:3,name:"王五"}],
            cols: [[ //表头
                {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'},
                {field:'name',title:'姓名'}
                ]]
        })
    })
</script>
